package huawei;

/**
 * 跳格子
 */
public class Q105 {

    static int[] score = {1,-1,5};
    static int k = 2;
    public static void main(String[] args) {
        int[] dp = new int[score.length];
        dp[0] = score[0];

        for (int i = 1; i < score.length; i++) {
            int max = Integer.MIN_VALUE;
            for (int j = Math.max(i - k, 0); j < i; j++) {
                max = Math.max(max, dp[j]);
            }
            dp[i] = max + score[i];
        }

        System.out.println(dp[score.length - 1]);
    }
}
